import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] array = { 1,3,5,7,2,4,6 };
        for (int i = 0; i < array.length; i++) {
            boolean flg = true;
            for (int j = 0; j < array.length -1 -i; j++) {
                if(array[j] > array[j + 1]){
                    int tmp = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = tmp;
                    flg = false;
                }
            }
            if(flg){
                break;
            }
        }
        System.out.println(Arrays.toString(array));
    }


    public static void main3(String[] args) {
        int[] array = { 1,2,7,9,9,6 };
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length -1 - i; j++) {
                if(array[j] % 2 == 0 && array[j+1] % 2 != 0){
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                }
            }
        }
        System.out.println(Arrays.toString(array));
    }



    public static double avg(int[] array){
        double sum = 0;
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        return sum/array.length;
    }
    public static void main2(String[] args) {
        int[] array = { 5,6,9,10,34 };
        System.out.println(avg(array));
    }





    public static void transform(int[] array){
        for (int i = 0; i <= array.length-1; i++) {
            array[i] *= 2;
        }
    }
    public static void main1(String[] args) {
        int[] array = { 1, 2, 3, 4 };
        transform(array);
        System.out.println(Arrays.toString(array));
    }
}
